package com.guoxue.dao.impl;



import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.IChapterConfigDao;
import com.guoxue.domain.ChapterConfigVo;
@Repository
public class ChapterConfigDaoImpl extends BaseDaoImpl<ChapterConfigVo> implements IChapterConfigDao{
	
	
	public void saveChapterConfig(ChapterConfigVo chapterConfig) {
		saveOrUpdate(chapterConfig);
	}
	
	public List<ChapterConfigVo> getChapterConfigList() {
		return find("FROM ChapterConfigVo");
	}

	@Override
	public void deleteCapter(Integer id) {
		executeHql("DELETE FROM ChapterConfigVo c WHERE c.chapterId = ?",  new Object[] {id});
	}

	@Override
	public List<ChapterConfigVo> getChapterConfigList(int beginChapterId, int endChapterId) {
		return find("FROM ChapterConfigVo c WHERE c.chapterId >=? AND c.chapterId <=?", new Object[] {beginChapterId,endChapterId});
	}

	@Override
	public ChapterConfigVo getChapterConfig(int beginChapterId, int endChapterId) {
		return get("FROM ChapterConfigVo c WHERE c.chapterId >=? AND c.chapterId <=?", new Object[] {beginChapterId,endChapterId});
	}
	
}
